Add MCP compile_route tool#92951
Add MCP compile_route tool#92951lukesandberg wants to merge 7 commits intoeviction_semantics_for_real_this_timefrom
compile_route tool#92951Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Tests Passed |
Stats from current PR🔴 1 regression
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
Merging this PR will degrade performance by 3.48%
Performance Changes
Comparing Footnotes
|
bc661cd to
852ab00
Compare
852ab00 to
765be4f
Compare
6910f57 to
9d239e3
Compare
765be4f to
c5f0530
Compare
8b16ef4 to
6ba65cc
Compare
6ba65cc to
46b10ce
Compare
Failing CI jobsCommit: 398e84e | About building and testing Next.js |

What?
Adds a
compile_routeMCP tool that triggers on-demand compilation of a specific route (app or pages) without issuing an HTTP request, and returns any compilation issues.Why?
Coding agents and benchmarking workflows need a way to warm the module graph or measure compile time for a route without standing up a live backend to satisfy the request. The existing path — hitting the URL — requires the route's runtime dependencies to be available and couples compile timing to request handling.
How?
mcp/compile_routeregistered inget-or-create-mcp-server.ts, backed by acompileRoute({ page, clientOnly })callback plumbed from both the Turbopack and webpack hot reloaders.ensurePage/handleRouteType), so the call path matches a first navigation.subscribeToChangesopt-out onensurePageand threads it throughhandleRouteType/handlePagesErrorRoute. One-shot MCP compilations skip HMR subscription wiring — without this, each call would leak a subscription that fires on every subsequent file change for the life of the dev server.mcp/compile_routein theMcpToolNameunion.test/development/mcp-server/mcp-server-compile-route.test.ts.